check validity of conformance window parameters (fixes #427)
authorDirk Farin <dirk.farin@gmail.com>
Sat, 4 Nov 2023 14:13:36 +0000 (15:13 +0100)
committerAndreas Henriksson <andreas@fatal.se>
Thu, 23 Apr 2026 10:45:20 +0000 (12:45 +0200)
(cherry picked from commit 221e767136b8c46c748ae35b79ec9b976b3da301)

Gbp-Pq: Name 0013-check-validity-of-conformance-window-parameters-fixe.patch

libde265/image.cc

index 39813b04d748f3d0816b8fad3b482b52251e866a..057705ce1112fab75180c27f0ffd4fb5bb7cdb66 100644 (file)
@@ -330,6 +330,14 @@ de265_error de265_image::alloc_image(int w,int h, enum de265_chroma c,
   int top    = sps ? sps->conf_win_top_offset : 0;
   int bottom = sps ? sps->conf_win_bottom_offset : 0;
 
+  if ((left+right)*WinUnitX >= width) {
+    return DE265_ERROR_CODED_PARAMETER_OUT_OF_RANGE;
+  }
+
+  if ((top+bottom)*WinUnitX >= height) {
+    return DE265_ERROR_CODED_PARAMETER_OUT_OF_RANGE;
+  }
+
   width_confwin = width - (left+right)*WinUnitX;
   height_confwin= height- (top+bottom)*WinUnitY;
   chroma_width_confwin = chroma_width -left-right;